package br.com.sovi.gwt.client.inicio.logoff;

import br.com.sovi.gwt.client.application.Application;
import br.com.sovi.gwt.client.application.ApplicationConstants;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;

public class LogoffController {

	public void efetuarLogoff() {

		LogoffServiceAsync service = GWT.create(LogoffService.class);

		service.efetuarLogoff(new AsyncCallback<Void>() {
			@Override
			public void onFailure(Throwable caught) {
				Window.alert("Erro ao efetuar logoff, mas retire esse alert.");
			}

			@Override
			public void onSuccess(Void result) {
				Application.get().removeAttribute(ApplicationConstants.USUARIO_LOGADO_ATTR);
			}
		});
	}

}
